/**
* \file dgv.cpp
*
* \brief This file encompasses the DGV application.
* \author Shekhar S. Chandra, 2008-2009
*
* This file is part of DGV Library.
*
* DGV is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DGV is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DGV.  If not, see <http://www.gnu.org/licenses/>.
*/
#include <QApplication>

#include "DGVMainVTK.h"

int main(int argc, char *argv[])
{
    QApplication app(argc,argv);
    QPixmap *pixmap = new QPixmap(":resources/dgv_logo.png");
    QPixmap *icon = new QPixmap(":resources/dgv_icon.png");
    QSplashScreen *splash = new QSplashScreen(*pixmap);
    bool success = false;

    splash->show();
    app.processEvents();
    app.setWindowIcon(QIcon(*icon));
    //splash.showMessage("Loading ...");
    app.processEvents();

    DGVMainVTK Main;
    app.processEvents();
    Main.setWindowTitle("DGV");
    Main.show();
    app.processEvents();

    ///Open files if provided
    QStringList files = app.arguments();
    app.processEvents();
    files.erase(files.begin()); //First element is the program name
    app.processEvents();
    Main.loadFiles(files);
    app.processEvents();
    splash->finish(&Main);

    success = app.exec();

    delete pixmap;
    delete icon;
    delete splash;

    return success;
}
